#pragma once

#include <sys_reg.h>

#define DAC_Q 0x40007400

typedef enum {
	DAC_CTL_R = 0x0,
	DAC_SWT_R = 0x4,
	DAC_DAC0_DO_R = 0x2C,
	DAC_DAC1_DO_R = 0x30,
} dac_re;

static inline u32_s dac_get_reg_q(dac_re dac_r) {
	return DAC_Q + dac_r;
}

static inline void dac_wreg(dac_re dac_r, u32_s value) {
	u32_s reg_q = dac_get_reg_q(dac_r);
	wreg(reg_q, value);
}

static inline u32_s dac_rreg(dac_re dac_r) {
	u32_s reg_q = dac_get_reg_q(dac_r);
	return rreg(reg_q);
}
